package org.grayrabbit.cloud.core.mina;

import java.io.IOException;

import org.grayrabbit.cloud.core.rpc.ChannelFactory;
import org.grayrabbit.cloud.core.rpc.LocalChannelFactory;
import org.grayrabbit.cloud.core.rpc.LocalServerFactory;
import org.grayrabbit.cloud.core.rpc.Result;
import org.grayrabbit.cloud.core.rpc.ServerFactory;


public class MinaFactory {
	private static ServerFactory serverFactory;
	private static ChannelFactory<Result> clientFactory;	
	
	public static synchronized ServerFactory getServerFactory(String file)
			throws IOException {
		if (serverFactory == null)
			serverFactory = new LocalServerFactory();
		return serverFactory;
	}
	   public static synchronized ChannelFactory<Result> getChannelFactory(String file)
	     throws IOException
	   {
	     if (clientFactory == null)
	    	 clientFactory = new LocalChannelFactory();
	     return clientFactory;
	   }
}
